package com.finger.userservice.controller.msg;

import com.finger.modelservice.result.Result;
import com.finger.userservice.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("site/user/msg")
public class MessageController {

    @Autowired
    private MessageService messageService;

    @PostMapping("sendMessage/{phone}")
    public Result sendMessage(@PathVariable String phone){

        boolean isSuccess = messageService.sendMessage(phone);

        if(isSuccess){
            return Result.ok();
        }

        return Result.fail();
    }
}
